using System;
using System.Collections.Generic;
using Drawing = System.Drawing;
using System.Text.RegularExpressions;

using Nairo.Parser.Dom;

namespace Nairo.Parser
{
	public struct SizeValue
	{
		public static readonly SizeValue XXSmall = new SizeValue(6.8, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue XSmall = new SizeValue(7.5, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue Small = new SizeValue(9.8, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue Medium = new SizeValue(12.0, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue Large = new SizeValue(13.5, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue XLarge = new SizeValue(18.0, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue XXLarge = new SizeValue(24.0, false, false, false, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.None);
		public static readonly SizeValue Smaller = new SizeValue(1.0, false, false, true, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.Smaller);
		public static readonly SizeValue Larger = new SizeValue(1.0, false, false, true, RelativeUnits.None, AbsoluteUnits.Points, SpecialSizeValues.Larger);
		public static readonly SizeValue Normal = new SizeValue(-1.0, false, false, false, RelativeUnits.None, AbsoluteUnits.None, SpecialSizeValues.None);
		public static readonly SizeValue Empty = new SizeValue(0.0, false, false, false, RelativeUnits.None, AbsoluteUnits.None, SpecialSizeValues.None);
		
		public const double resizeFactor = 0.85;
		
		double value;
		bool isRelative;
		bool isPercent;
		bool isSpecial;
		RelativeUnits relUnit;
		AbsoluteUnits absUnit;
		SpecialSizeValues special;
		
		public SizeValue(double value, bool isRelative, bool isPercent, bool isSpecial, RelativeUnits relUnit, AbsoluteUnits absUnit, SpecialSizeValues special)
		{
			this.value = value;
			this.isRelative = isRelative;
			this.isPercent = isPercent;
			this.isSpecial = isSpecial;
			this.relUnit = relUnit;
			this.absUnit = absUnit;
			this.special = special;
		}
		
		public double Value {
			get { return value; }
			set { this.value = value; }
		}
		
		public bool IsRelative {
			get { return isRelative; }
			set { isRelative = value; }
		}
		
		public bool IsPercent {
			get { return isPercent; }
			set { isPercent = value; }
		}
		
		public bool IsSpecial {
			get { return isSpecial; }
			set { isSpecial = value; }
		}
		
		public RelativeUnits RelUnit {
			get { return relUnit; }
			set { relUnit = value; }
		}
		
		public AbsoluteUnits AbsUnit {
			get { return absUnit; }
			set { absUnit = value; }
		}
		
		public SpecialSizeValues Special {
			get { return special; }
			set { special = value; }
		}
		
		public override string ToString()
		{
			return string.Format("[SizeValue Value={0} IsRelative={1} IsPercent={2} IsSpecial={3} RelUnit={4} AbsUnit={5} Special={6}]", this.value, this.isRelative, this.isPercent, this.isSpecial, this.relUnit, this.absUnit, this.special);
		}
	}
}
